home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / jasperValues.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  43.1 KB  |  1,512 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //    jasperValues.mel
  19. //
  20.  
  21. // ================= Values for each section =====================
  22. global string   $jasperObjExpanded[];
  23. global int      $jasperObjExpandedSize = 0;
  24.  
  25. global proc jasperObjExpandedReset(
  26.     string $jasperCommand, 
  27.     string $toolName,
  28.     string $expand // true or false
  29. )
  30. {
  31.     global string   $jasperObjExpanded[];
  32.     global int      $jasperObjExpandedSize;
  33.  
  34.     $cmd = ($jasperCommand + " -q -ots " + $toolName);
  35.     $jasperObjExpandedSize = `eval $cmd`;
  36.     
  37.     for( $i = 0; $i < $jasperObjExpandedSize; $i++ ) {
  38.         $jasperObjExpanded[$i] = $expand;
  39.     }
  40. }
  41.  
  42.  
  43. global proc jasperStampPressure(
  44.     string  $jasperCommand,
  45.     int $enable 
  46. )
  47. {
  48.     radioButtonGrp -e -en $enable pressure0Radio;
  49.     if( $enable == false )
  50.     {
  51.         radioButtonGrp -e -sl 1 pressure0Radio;
  52.         string $cmd = $jasperCommand + "-e -pressure \"none\" `currentCtx`";
  53.         eval $cmd;
  54.     }
  55. }
  56.  
  57. global proc jasperStampProfileValues( 
  58.     string $jasperCommand, 
  59.     string $toolName,
  60.     string $currentTool,
  61.     int    $force 
  62. )
  63. {
  64.     string $cmd;
  65.     global int $jasperStampActive;
  66.  
  67.     // print ("jasperStampValues( " + $force + ") active = " 
  68.     //         + $jasperStampActive + "\n");
  69.  
  70.     if ( !$force && $jasperStampActive ) {
  71.         return;
  72.     }
  73.     $jasperStampActive = 1;
  74.  
  75.     // change radius field bounds, values and units label depending on
  76.     // compensation mode
  77.     //
  78.     $cmd = ($jasperCommand + " -q -compensate " + $toolName);
  79.     string $compensate = `eval $cmd`;
  80.     $cmd = ($jasperCommand + " -q -lowerradius " + $toolName);
  81.     float $lowerRadius = `eval $cmd`;
  82.     $cmd = ($jasperCommand + " -q -radius " + $toolName);
  83.     float $radius = `eval $cmd`;
  84.     if ( $compensate == "none" ) {
  85.         text -e -l "% of surf" lowerRadiusUnits;
  86.         text -e -l "% of surf" radiusUnits;
  87.         floatSliderGrp -e
  88.             -max 50.0 -fmx 50.0 -v $lowerRadius
  89.             lowerRadius;
  90.         floatSliderGrp -e
  91.             -max 50.0 -fmx 50.0 -v $radius
  92.             radius;
  93.     } else {
  94.         text -e -l `currentUnit -q -l` lowerRadiusUnits;
  95.         text -e -l `currentUnit -q -l` radiusUnits;
  96.  
  97.         global float $jasperBigFloat;
  98.  
  99.         floatSliderGrp -e
  100.             -max 10.0 -fmx $jasperBigFloat -v $lowerRadius
  101.             lowerRadius;
  102.         floatSliderGrp -e
  103.             -max 10.0 -fmx $jasperBigFloat -v $radius
  104.             radius;
  105.     }
  106.  
  107.     if ( ( $currentTool != "selectPaint" ) && ( $currentTool != "setEditPaint" ) ) {
  108.  
  109.         $cmd = ($jasperCommand + " -q -opacity " + $toolName);
  110.         floatSliderGrp -e -v `eval $cmd` opacitySlider;
  111.  
  112.         if ($currentTool == "wtPaint" || $currentTool == "userPaint"
  113.             || $currentTool == "attrPaint"
  114.             || attrPaintInstCheckTool($currentTool) )
  115.         {
  116.             float $col[];
  117.             $cmd = ($jasperCommand + " -q -color " + $toolName);
  118.  
  119.             $col = `eval $cmd`;
  120.             floatSliderGrp -e -v $col[0] colorSlider;
  121.         }
  122.     }
  123.  
  124.     $cmd = ($jasperCommand + " -q -brushshape " + $toolName);
  125.     string $shape = `eval $cmd`;
  126.     if ( $shape == "circle1" ) {
  127.         updateBrushShapeIcons -byCirclePoly;
  128.     } else if ( $shape == "circle2" ) {
  129.         updateBrushShapeIcons -byCircleGaus;
  130.     } else if ( $shape == "circle3" ) {
  131.         updateBrushShapeIcons -byCircleSolid;
  132.     } else if ( $shape == "semiCircle1" ) {
  133.         updateBrushShapeIcons -bySemiCirclePoly;
  134.     } else if ( $shape == "semiCircle2" ) {
  135.         updateBrushShapeIcons -bySemiCircleSolid;
  136.     } else if ( $shape == "rectangle" ) {
  137.         updateBrushShapeIcons -byRect;
  138.     } else if ( $shape == "lineH" ) {
  139.         updateBrushShapeIcons -byLineH;
  140.     } else if ( $shape == "lineV" ) {
  141.         updateBrushShapeIcons -byLineV;
  142.     }       
  143. }
  144.  
  145.  
  146. global proc jasperValueValues( 
  147.     string $jasperCommand, 
  148.        string $toolName,
  149.        string $currentTool,
  150.     int    $force,
  151.     int    $extendValue,
  152.     string $extendValueValues
  153. )
  154. {
  155.     string $cmd;
  156.     global int $jasperWeightActive;
  157.  
  158.     // print ("jasperValueValues( " + $force + ") active = " 
  159.     //          + $jasperWeightActive + "\n");
  160.  
  161.     if ( !$force && $jasperWeightActive ) return;
  162.     $jasperWeightActive = 1;
  163.  
  164.     //
  165.     // Stamp Profile frameLayout
  166.     //
  167.     jasperStampProfileValues( $jasperCommand, $toolName, 
  168.                   $currentTool, $force 
  169.     );
  170.  
  171.     // 
  172.     //    Operation frameLayout
  173.     //
  174.     $cmd = ($jasperCommand + " -q -edittype " + $toolName);
  175.     string $operation =  `eval $cmd`;
  176.     if ( $operation == "absolute" ) {
  177.         radioButtonGrp -e -sl 1 op0Radio;
  178.     } else if ( $operation == "additive" ) {
  179.         radioButtonGrp -e -sl 2 op0Radio;
  180.     } else if ( $operation == "scale" ) {
  181.         radioButtonGrp -e -sl 3 op0Radio;
  182.     } else if ( $operation == "smooth" ) {
  183.         radioButtonGrp -e -sl 4 op0Radio;
  184.     }
  185.     
  186.     
  187.     //
  188.     //    Weight Painting frameLayout
  189.     //
  190.     $cmd = ($jasperCommand + " -q -offset " + $toolName);
  191.     floatSliderGrp -e -v `eval $cmd` ptOffset;
  192.     $cmd = ($jasperCommand + " -q -mult " + $toolName);
  193.     floatSliderGrp -e -v `eval $cmd` ptMult;
  194.  
  195.     $cmd = ($jasperCommand + " -q -clamplower " + $toolName);
  196.     floatSliderGrp -e -v `eval $cmd` clLower;
  197.     $cmd = ($jasperCommand + " -q -clampupper " + $toolName);
  198.     floatSliderGrp -e -v `eval $cmd` clUpper;
  199.  
  200.     //
  201.     //    Clamping frameLayout
  202.     //
  203.     $cmd = ($jasperCommand + " -q -clamp " + $toolName);
  204.     string $clamp = `eval $cmd`;
  205.     if ( $clamp == "none" ) {
  206.         radioButtonGrp -e -sl 1 clampRadio;
  207.     } else if ( $clamp == "both" ) {
  208.         radioButtonGrp -e -sl 2 clampRadio;
  209.     } else if ( $clamp == "lower" ) {
  210.         radioButtonGrp -e -sl 3 clampRadio;
  211.     } else if ( $clamp == "upper" ) {
  212.         radioButtonGrp -e -sl 4 clampRadio;
  213.     }
  214.     
  215.     if( $extendValue )
  216.     {
  217.         string $cmd = $extendValueValues + " " + $jasperCommand + " "
  218.             + $toolName + " " + $currentTool + " " + $force;
  219.         eval $cmd;
  220.     }
  221.  
  222.     if ( $currentTool == "wtPaint" ) {
  223.         $cmd  = ($jasperCommand + " -q -clusternames " + $toolName);
  224.         string $clusterListStr = `eval $cmd`; 
  225.         string $clusters[];
  226.         tokenize($clusterListStr, " ", $clusters);    
  227.  
  228.         textScrollList -e -ra weightScrollList;
  229.          for( $s in $clusters ) {
  230.             textScrollList -e -append $s weightScrollList;
  231.         }
  232.     }
  233. }
  234.  
  235.  
  236. proc jasperStrokeValues( 
  237.     string $jasperCommand, 
  238.     string $toolName,
  239.     string $currentTool,
  240.     int $force 
  241. )
  242. {
  243.     string $cmd;
  244.     global int $jasperStrokeActive;
  245.  
  246.     //  print ("jasperStrokeValues( " + $force + ") active = " 
  247.     //          + $jasperStrokeActive + "\n");
  248.  
  249.     if ( !$force && $jasperStrokeActive ) return;
  250.     $jasperStrokeActive = 1;
  251.  
  252.     // 
  253.     //    Reflect Paint frameLayout
  254.     //
  255.     $cmd = ($jasperCommand + " -q -reflectpaint " + $toolName);
  256.     checkBoxGrp -e -v1 `eval $cmd` reflectStrokeChkBox;
  257.  
  258.     $cmd = ($jasperCommand + " -q -reflectpainttype " + $toolName);
  259.     string $operation = `eval $cmd`;
  260.     if ( $operation == "reflectU" ) 
  261.     {
  262.         radioButtonGrp -e -sl 1 refPaint0Radio;
  263.     } 
  264.     else if ( $operation == "reflectV" ) 
  265.     {
  266.         radioButtonGrp -e -sl 1 refPaint1Radio;
  267.     }
  268.     else if ( $currentTool != "paintColor" ) {
  269.         if ( $operation == "reflectMult" ) {
  270.             radioButtonGrp -e -sl 1 refPaint2Radio;
  271.         } 
  272.     }
  273.  
  274.     $cmd = ($jasperCommand + " -q -reflectalongu " + $toolName);
  275.     floatSliderGrp -e -v `eval $cmd` singleUSlider;
  276.  
  277.     $cmd = ($jasperCommand + " -q -reflectalongv " + $toolName);
  278.     floatSliderGrp -e -v `eval $cmd` singleVSlider;
  279.  
  280.     if ( $currentTool == "putty" ) {
  281.         $cmd = ($jasperCommand + " -q -invertrefvector " + $toolName);
  282.         checkBoxGrp -e -v1 `eval $cmd` invertVectorChkBox;
  283.     }
  284.  
  285.     //
  286.     // Stylus Pressure frameLayout
  287.     //
  288.     $cmd = ($jasperCommand + " -q -pressure " + $toolName);
  289.     string $pressure = `eval $cmd`;
  290.     if ( $pressure == "none" ) {
  291.         radioButtonGrp -e -sl 1 pressure0Radio;
  292.     } else if ( $pressure == "opacity" ) {
  293.         radioButtonGrp -e -sl 2 pressure0Radio;
  294.     } else if ( $pressure == "radius" ) {
  295.         radioButtonGrp -e -sl 3 pressure0Radio;
  296.     } else if ( $pressure == "both" ) {
  297.         radioButtonGrp -e -sl 4 pressure0Radio;
  298.     }
  299.  
  300.     $cmd = ($jasperCommand + " -q -tabletexist " + $toolName);
  301.     string $pressure = `eval $cmd`;
  302.     if ( $pressure == true ) {
  303.         jasperStampPressure( $jasperCommand, true );
  304.     } else {
  305.         jasperStampPressure( $jasperCommand, false );
  306.     }
  307.  
  308.     //
  309.     //    Profile Alignment frameLayout
  310.     //
  311.     $cmd = ($jasperCommand + " -q -crt " + $toolName);
  312.     $compensate = `eval $cmd`;
  313.     if ( $compensate == "utangent" ) {
  314.         radioButtonGrp -e -sl 1 compRef0Radio;
  315.     } else if ( $compensate == "vtangent" ) {
  316.         radioButtonGrp -e -sl 2 compRef0Radio;
  317.     } else if ( $compensate == "upvector" ) {
  318.         radioButtonGrp -e -sl 1 compRef1Radio;
  319.     } else if ( $compensate == "pathvector" ) {
  320.         radioButtonGrp -e -sl 2 compRef1Radio;
  321.     }
  322. }
  323.  
  324. global proc updateCommEdgeOneDisplayScreen( 
  325.     string $jasperCommand 
  326. )
  327. {
  328.     string $cmd;
  329.  
  330.     // update the text on common edge one display
  331.     $cmd = ($jasperCommand + " -q -commedgerefname  `currentCtx`");
  332.     textFieldGrp -e -tx `eval $cmd` commEdgeRefPainterName;
  333.  
  334.     $cmd = ($jasperCommand + " -q -commedgerefedge  `currentCtx`");
  335.     textFieldGrp -e -tx `eval $cmd` commEdgeRefPainterEdge;
  336.  
  337.     $cmd = ($jasperCommand + " -q -commedgetarname  `currentCtx`");
  338.     textFieldGrp -e -tx `eval $cmd` commEdgeTarPainterName;
  339.  
  340.     $cmd = ($jasperCommand + " -q -commedgetaredge  `currentCtx`");
  341.     textFieldGrp -e -tx `eval $cmd` commEdgeTarPainterEdge;    
  342. }
  343.  
  344.  
  345. global proc updateCommEdgeDisplayScreen( 
  346.     string $jasperCommand 
  347. )
  348. {
  349.     if( !`floatSliderGrp -q -ex commEdgesTol` ) return;
  350.  
  351.     string $cmd = ($jasperCommand + " -q -brushoperate `currentCtx`");
  352.     string $type = `eval $cmd`;
  353.     if ( $type == "paint" ) {
  354.         // enable display mode
  355.         floatSliderGrp -e -en true commEdgesTol;    
  356.         floatSliderGrp -e -en true commEdgesMinLength;
  357.         floatSliderGrp -e -en true collapseCVTol;
  358.         radioButtonGrp -e -en true commEdgesDisplay2;
  359.         radioButtonGrp -e -en true commEdgesDisplay0;
  360.         radioButtonGrp -e -en true commEdgesDisplay1;
  361.         radioButtonGrp -e -en true commCornerDisplay0;
  362.         radioButtonGrp -e -en true commCornerDisplay1;
  363.  
  364.         $cmd = ($jasperCommand + " -q -commedgedisplay `currentCtx`");
  365.         string $display = `eval $cmd`;
  366.         if ( $display == "one" ) {
  367.             text -e -vis true commEdge1Text;
  368.             text -e -vis true commEdge2Text;
  369.             text -e -vis true commEdge3Text;
  370.             text -e -vis true commEdge4Text;
  371.             textFieldGrp  -e -vis true commEdgeRefPainterName;
  372.             textFieldGrp  -e -vis true commEdgeRefPainterEdge;
  373.             textFieldGrp  -e -vis true commEdgeTarPainterName;
  374.             textFieldGrp  -e -vis true commEdgeTarPainterEdge;
  375.             button        -e -vis true commEdgeDisplayOneNext;
  376.             button        -e -vis true commEdgeDisplayOnePrev;
  377.         } else {
  378.             text -e -vis false commEdge1Text;
  379.             text -e -vis false commEdge2Text;
  380.             text -e -vis false commEdge3Text;
  381.             text -e -vis false commEdge4Text;
  382.             textFieldGrp -e -vis false commEdgeRefPainterName;
  383.             textFieldGrp -e -vis false commEdgeRefPainterEdge;
  384.             textFieldGrp -e -vis false commEdgeTarPainterName;
  385.             textFieldGrp -e -vis false commEdgeTarPainterEdge;
  386.             button  -e -vis false commEdgeDisplayOneNext;
  387.             button  -e -vis false commEdgeDisplayOnePrev;
  388.         }
  389.     } 
  390.     else {
  391.         floatSliderGrp -e -en false commEdgesTol;    
  392.         floatSliderGrp -e -en false commEdgesMinLength;
  393.         floatSliderGrp -e -en false collapseCVTol;
  394.  
  395.         radioButtonGrp -e -en false commEdgesDisplay0;
  396.         radioButtonGrp -e -en false commEdgesDisplay1;
  397.         radioButtonGrp -e -en false commEdgesDisplay2;
  398.  
  399.         radioButtonGrp -e -en false commCornerDisplay0;
  400.         radioButtonGrp -e -en false commCornerDisplay1;
  401.  
  402.         text -e -vis false commEdge1Text;
  403.         text -e -vis false commEdge2Text;
  404.         text -e -vis false commEdge3Text;
  405.         text -e -vis false commEdge4Text;
  406.  
  407.         textFieldGrp -e -vis false commEdgeRefPainterName;
  408.         textFieldGrp -e -vis false commEdgeRefPainterEdge;
  409.         textFieldGrp -e -vis false commEdgeTarPainterName;
  410.         textFieldGrp -e -vis false commEdgeTarPainterEdge;
  411.         button  -e -vis false commEdgeDisplayOneNext;
  412.         button  -e -vis false commEdgeDisplayOnePrev;
  413.     }
  414. }
  415.  
  416.  
  417. proc jasperSeamValues(
  418.     string $jasperCommand, 
  419.     string $toolName,
  420.     string $currentTool,
  421.     int    $force
  422. )
  423. {
  424.     string $cmd;
  425.     global int $jasperSeamActive;
  426.  
  427.     //  print ("jasperSeamValues( " + $force + ") active = " 
  428.     //          + $jasperSeamActive + "\n");
  429.  
  430.     if ( !$force && $jasperSeamActive )  return;
  431.     $jasperSeamActive = 1;
  432.  
  433.     if ( $currentTool == "putty" || $currentTool == "wtPaint" 
  434.          || $currentTool == "userPaint" || $currentTool == "attrPaint" 
  435.          || attrPaintInstCheckTool($currentTool) ) 
  436.     {
  437.         //
  438.         //    Brush Mode frameLayout
  439.         //
  440.         $cmd = ($jasperCommand + " -q -brushoperate " + $toolName);
  441.         string $type = `eval $cmd`;
  442.         if ( $type == "paint" ) {
  443.             radioButtonGrp -e -sl 1 brushOperationType;
  444.         } else if ( $type == "selectedge" ) {
  445.             radioButtonGrp -e -sl 2 brushOperationType;
  446.         } else if ( $type == "selectcorner" ) {
  447.             radioButtonGrp -e -sl 3 brushOperationType;
  448.         }
  449.  
  450.         //
  451.         //    Seam AutoCreation frameLayout
  452.         //    
  453.         $cmd = ($jasperCommand + " -q -commedgetol " + $toolName);
  454.         floatSliderGrp -e -v `eval $cmd` commEdgesTol;
  455.         text -e -l `currentUnit -q -l` commEdgesTolUnits;
  456.         
  457.         $cmd = ($jasperCommand + " -q -commedgeminlength " + $toolName);
  458.         floatSliderGrp -e -v `eval $cmd` commEdgesMinLength;
  459.         text -e -l `currentUnit -q -l` commEdgesMinLengthUnits;
  460.         
  461.         //
  462.         //    Common Edge/Corner frameLayout
  463.         //
  464.         $cmd = ($jasperCommand + " -q -commedgedisplay " + $toolName);
  465.         string $type = `eval $cmd`;
  466.         if ( $type == "off" ) {
  467.             radioButtonGrp -e -sl 1 commEdgesDisplay0;
  468.         } else if ( $type == "one" ) {
  469.             radioButtonGrp -e -sl 1 commEdgesDisplay1;
  470.         } else if ( $type == "all" ) {
  471.             radioButtonGrp -e -sl 1 commEdgesDisplay2;
  472.         }
  473.  
  474.         $cmd = ($jasperCommand + " -q -ccd " + $toolName);
  475.         string $type = `eval $cmd`;
  476.         if ( $type == "off" ) {
  477.             radioButtonGrp -e -sl 1 commCornerDisplay0;
  478.         } else if ( $type == "all" ) {
  479.             radioButtonGrp -e -sl 1 commCornerDisplay1;
  480.         }
  481.         
  482.         updateCommEdgeOneDisplayScreen( $jasperCommand );
  483.         updateCommEdgeDisplayScreen( $jasperCommand );
  484.     }
  485.  
  486.     $cmd = ($jasperCommand + " -q -collapsecvtol " + $toolName);
  487.     floatSliderGrp -e -v `eval $cmd` collapseCVTol;
  488.     text -e -l `currentUnit -q -l` collapseCVTolUnits;    
  489.     
  490.     //
  491.     //    Stitching Mode frameLayout
  492.     //
  493.     if ( $currentTool == "putty" ) {
  494.         $cmd = ($jasperCommand + " -q -stitchtype " + $toolName);
  495.         string $type = `eval $cmd`;
  496.         if ( $type == "off" ) {
  497.             checkBoxGrp -e -en false stitchCornerChkBox;
  498.             radioButtonGrp -e -sl 1 stitchTypeRadio;
  499.         } else if ( $type == "pos" ) {
  500.             checkBoxGrp -e -en true stitchCornerChkBox;
  501.             radioButtonGrp -e -sl 2 stitchTypeRadio;
  502.         } else if ( $type == "tan" ) {
  503.             checkBoxGrp -e -en true stitchCornerChkBox;
  504.             radioButtonGrp -e -sl 3 stitchTypeRadio;
  505.         }
  506.  
  507.            $cmd = ($jasperCommand + " -q -stitchcorner " + $toolName);
  508.         checkBoxGrp -e -v1 `eval $cmd` stitchCornerChkBox;
  509.  
  510.            $cmd = ($jasperCommand + " -q -polecv " + $toolName);
  511.         checkBoxGrp -e -v1 `eval $cmd` stitchPoleCVChkBox;
  512.     }
  513.     //
  514.     // Common Edge Value Averaging
  515.     // - this is only displayed if we are in wtPaint or userPaint
  516.     //
  517.     else if ( $currentTool == "wtPaint" || $currentTool == "userPaint"
  518.               || $currentTool == "attrPaint" 
  519.               || $currentTool == "attrPaintInst" )
  520.     {
  521.            $cmd = ($jasperCommand + " -q -averageedges " + $toolName);
  522.         checkBoxGrp -e -v1 `eval $cmd` averageEdgeValues;
  523.  
  524.           $cmd = ($jasperCommand + " -q -averagepolecv " + $toolName);
  525.         checkBoxGrp -e -v1 `eval $cmd` averagePoleCVValues;
  526.     }
  527.  
  528.     updateSeamProperties( $jasperCommand );
  529. }
  530.  
  531.  
  532. proc jasperMaskValues(
  533.     string $jasperCommand,
  534.     string $toolName,
  535.     int $force 
  536. )
  537. {
  538.     string $cmd;
  539.     global int $jasperMaskActive;
  540.  
  541.     if ( !$force && $jasperMaskActive )  return;
  542.     $jasperMaskActive = 1;
  543.  
  544.     //
  545.     // CV Mask frameLayout
  546.     //
  547.     $cmd = ($jasperCommand + " -q -maskcv " + $toolName);
  548.     string $type = `eval $cmd`;
  549.     if ( $type == "off" ) {
  550.         radioButtonGrp -e -sl 1 cvMaskType;
  551.     } else if ( $type == "select" ) {
  552.         radioButtonGrp -e -sl 2 cvMaskType;
  553.     } else if ( $type == "unselect" ) {
  554.         radioButtonGrp -e -sl 3 cvMaskType;
  555.     }
  556.  
  557.     $cmd = ($jasperCommand + " -q -displaycv " + $toolName);
  558.     checkBoxGrp -e -v1 `eval $cmd` cvMaskDisplay;
  559.  
  560.     $cmd = ($jasperCommand + " -q -maskcvenable " + $toolName);
  561.     string $mask = `eval $cmd`;
  562.  
  563.     // grey out masking if masking is disabled
  564.     if ( $mask == true ) {
  565.         radioButtonGrp -e -en true cvMaskType;
  566.         checkBoxGrp -e -en true cvMaskDisplay;
  567.     }
  568.     else {
  569.         radioButtonGrp -e -en false cvMaskType;
  570.         checkBoxGrp -e -en false cvMaskDisplay;
  571.     }
  572. }
  573.  
  574.  
  575. proc jasperMapValues( 
  576.     string $jasperCommand,
  577.     string $toolName,
  578.     string $currentTool,
  579.     int $force 
  580. )
  581. {
  582.     string $cmd;
  583.     global int $jasperMapActive;
  584.  
  585.     if ( !$force && $jasperMapActive ) return;
  586.     $jasperMapActive = 1;
  587.  
  588.     string $attrToolName = "";
  589.  
  590.     //
  591.     //  Import Map frameLayout
  592.     //
  593.     $cmd = ($jasperCommand + " -q -importfilename " + $toolName);
  594.     textFieldGrp -e -fileName `eval $cmd` importMapNameField;
  595.  
  596.     $cmd = ($jasperCommand + " -q -importreassign " + $toolName);
  597.     checkBoxGrp -e -v1 `eval $cmd` reassignMapsChkBox;
  598.  
  599.     updateReloadButton( $jasperCommand );
  600.  
  601.     $cmd = ($jasperCommand + " -q -importfilemode " + $toolName);
  602.     string $importMode= `eval $cmd`;
  603.     if ( $importMode == "alpha" ) {
  604.         radioButtonGrp -e -sl 1 importMapAlphaValueRadio1;
  605.     } else if ( $importMode == "luminance" ) {
  606.         radioButtonGrp -e -sl 2 importMapAlphaValueRadio1;
  607.     } else if ( $importMode == "red" ) {
  608.         radioButtonGrp -e -sl 1 importMapAlphaValueRadio2;
  609.     } else if ( $importMode == "green" ) {
  610.         radioButtonGrp -e -sl 2 importMapAlphaValueRadio2;
  611.     } else if ( $importMode == "blue" ) {
  612.         radioButtonGrp -e -sl 3 importMapAlphaValueRadio2;
  613.     }
  614.     if ( attrPaintInstCheckTool($currentTool) ) {
  615.         string $name = eval("attrPaintCtx -q -bcn `currentCtx`");
  616.         if ( $name == "polyClrVertPaint" ) {
  617.             if ( $importMode == "rgb" ) {
  618.                 radioButtonGrp -e -sl 1 importMapAlphaValueRadio3;
  619.             } else if ( $importMode == "rgba" ) {
  620.                 radioButtonGrp -e -sl 2 importMapAlphaValueRadio3;
  621.             }
  622.         }
  623.     }
  624.  
  625.     if ( $currentTool == "selectPaint" ) {
  626.         $cmd = ($jasperCommand + " -q -importthreshold " + $toolName);
  627.         floatSliderGrp -e -v `eval $cmd` importSelectCVThresholdSlider;
  628.     }
  629.  
  630.     //
  631.     //  Export Map frameLayout
  632.     //
  633.     if ( ( $currentTool == "wtPaint" )  || 
  634.          ( $currentTool == "userPaint") ||
  635.          ( $currentTool == "attrPaint") ||
  636.          ( attrPaintInstCheckTool($currentTool) ) ||
  637.          ( $currentTool == "selectPaint") 
  638.         )
  639.     {
  640.         $cmd = ($jasperCommand + " -q -exportfilename " + $toolName);
  641.         textFieldGrp -e -fileName `eval $cmd` exportMapNameField;
  642.     
  643.         updateResaveButton( $jasperCommand );
  644.  
  645.         $cmd = ($jasperCommand + " -q -exportfilemode " + $toolName);
  646.         string $exportVal = `eval $cmd`;
  647.  
  648.         if ( attrPaintInstCheckTool($currentTool) ) {
  649.             $attrToolName = eval("attrPaintCtx -q -bcn `currentCtx`");
  650.         }
  651.         // if this is not 3d color paint tool (1d case)
  652.         // 
  653.         if ( $attrToolName != "polyClrVertPaint" ) {
  654.             if ( $exportVal == "alpha" ) {
  655.                 radioButtonGrp -e -sl 1 exportMapValueRadio1;
  656.             } else if ( $exportVal == "luminance" ) { // same as rgb in 3d
  657.                 radioButtonGrp -e -sl 2 exportMapValueRadio1;
  658.             } else if ( $exportVal == "rgb" ) {          // same as luminance in 1d
  659.                 radioButtonGrp -e -sl 2 exportMapValueRadio1;
  660.             } else if ( $exportVal == "rgba" ) {      // same as luminance in 1d
  661.                 radioButtonGrp -e -sl 2 exportMapValueRadio1;
  662.             }
  663.         } else {
  664.             if ( $exportVal == "alpha" ) {
  665.                 radioButtonGrp -e -sl 1 exportMapValueRadio2;
  666.             } else if ( $exportVal == "luminance" ) { // same as rgb in 3d
  667.                 radioButtonGrp -e -sl 2 exportMapValueRadio2;
  668.             } else if ( $exportVal == "rgb" ) {          // same as luminance in 1d
  669.                 radioButtonGrp -e -sl 2 exportMapValueRadio2;
  670.             } else if ( $exportVal == "rgba" ) {      // same as luminance in 1d
  671.                 radioButtonGrp -e -sl 3 exportMapValueRadio2;
  672.             }
  673.         }
  674.  
  675.         $cmd = ($jasperCommand + " -q -exportfilesizex " + $toolName);
  676.         intSliderGrp -e -v `eval $cmd` exportMapSizeXSlider;
  677.  
  678.         $cmd = ($jasperCommand + " -q -exportfilesizey " + $toolName);
  679.         intSliderGrp -e -v `eval $cmd` exportMapSizeYSlider;
  680.  
  681.         $cmd = ($jasperCommand + " -q -exportfiletype " + $toolName);
  682.         optionMenuGrp -e -v `eval $cmd` imageFormatOptionMenu;
  683.     }
  684. }
  685.  
  686. global proc updateReloadButton(
  687.     string $jasperCommand
  688. )
  689. {
  690.     string $fileName = eval("textFieldGrp -q -fileName importMapNameField");
  691.  
  692.     if ( $fileName != "" ) {
  693.         button -e -en true importReloadButton;
  694.     }
  695.     else {
  696.         button -e -en false importReloadButton;
  697.     }
  698. }
  699.  
  700. global proc updateResaveButton(
  701.     string $jasperCommand
  702. )
  703. {
  704.     string $fileName= eval("textFieldGrp -q -fileName exportMapNameField");
  705.  
  706.     if ( $fileName!= "" ) {
  707.         button -e -en true exportReloadButton;
  708.     }
  709.     else {
  710.         button -e -en false exportReloadButton;
  711.     }
  712. }
  713.  
  714.  
  715. global proc adjustMapSizeSlider(
  716.     string $jasperCommand,
  717.     string $whichSlider
  718. )
  719. {
  720.     float $ratio;
  721.     if ( eval("checkBoxGrp -q -v1 exportKeepAspectChkBox") ) {
  722.  
  723.         $ratio = eval($jasperCommand + " -q -exportaspectratio `currentCtx`");
  724.  
  725.         if ( $whichSlider == "xSlider" ) {
  726.             float $valX   = eval("intSliderGrp -q -v exportMapSizeXSlider");
  727.             float $newVal = $valX/$ratio;
  728.             intSliderGrp -e -v $newVal exportMapSizeYSlider;
  729.             eval($jasperCommand + " -e -exportfilesizey " + $newVal + " `currentCtx`");
  730.         }
  731.         else {
  732.             float $valY   = eval("intSliderGrp -q -v exportMapSizeYSlider");
  733.             float $newVal = $valY*$ratio;
  734.             intSliderGrp -e -v $newVal exportMapSizeXSlider;
  735.             eval($jasperCommand + " -e -exportfilesizex " + $newVal + " `currentCtx`");
  736.         }
  737.     }
  738. }
  739.  
  740. global proc setAspectRatio(
  741.     string $jasperCommand
  742. )
  743. {
  744.     if ( eval("checkBoxGrp -q -v1 exportKeepAspectChkBox") ) {
  745.  
  746.         float  $valX  = eval("intSliderGrp -q -v exportMapSizeXSlider");
  747.         float  $valY  = eval("intSliderGrp -q -v exportMapSizeYSlider");
  748.     
  749.         // calculate the aspect ratio
  750.         float  $ratio = $valX/$valY;
  751.  
  752.         // set the aspect ratio in jasper
  753.         eval($jasperCommand + " -e -exportaspectratio " + $ratio + " `currentCtx`");
  754.     }
  755. }
  756.  
  757.  
  758. proc jasperDisplayValues(
  759.     string $jasperCommand,
  760.     string $toolName,
  761.     string $currentTool,
  762.     int $force
  763. )
  764. {
  765.     string $cmd;
  766.     global int $jasperDisplayActive;
  767.  
  768.     //  print ("jasperDisplayValues( " + $force + ") active = " 
  769.     //          + $jasperDisplayActive + "\n");
  770.  
  771.     if ( !$force && $jasperDisplayActive ) {
  772.         return;
  773.     }
  774.     $jasperDisplayActive = 1;
  775.  
  776.     //
  777.     //    Surface frameLayout
  778.     //
  779.     $cmd = ($jasperCommand + " -q -outline " + $toolName);
  780.     checkBoxGrp -e -v1 `eval $cmd` drawOutlineChkBox;
  781.  
  782.     $cmd = ($jasperCommand + " -q -brushfeedback " + $toolName);
  783.     checkBoxGrp -e -v1 `eval $cmd` brushFeedbackChkBox;
  784.  
  785.     $cmd = ($jasperCommand + " -q -outlinepaint " + $toolName);
  786.     checkBoxGrp -e -v1 `eval $cmd` drawOutlinePaintingChkBox;
  787.  
  788.     $cmd = ($jasperCommand + " -q -outlinepaint " + $toolName);
  789.     checkBoxGrp -e -v1 `eval $cmd` drawOutlinePaintingChkBox;
  790.  
  791.     $cmd = ($jasperCommand + " -q -showactive " + $toolName);
  792.     checkBoxGrp -e -v1 `eval $cmd` showActiveLinesChkBox;
  793.  
  794.     // call a new global function for setting the brush feedback
  795.     updateBrushFeedback( $jasperCommand );
  796.  
  797.  
  798.     // 
  799.     //    Color feedback frameLayout
  800.     //
  801.     if (( $currentTool == "wtPaint" ) || ( $currentTool == "userPaint")
  802.         || $currentTool == "attrPaint" 
  803.         || ( $currentTool == "attrPaintInst"))
  804.     {
  805.         $cmd = ($jasperCommand + " -q -colorfeedback " + $toolName);
  806.         checkBoxGrp -e -v1 `eval $cmd` colorFeedbackChkBox;
  807.         $cmd = ($jasperCommand + " -q -disablelighting " + $toolName);
  808.         checkBoxGrp -e -v1 `eval $cmd` disableLightingChkBox;
  809.         if ( $currentTool == "wtPaint" ) {
  810.             $cmd = ($jasperCommand + " -q -usesetcolor " + $toolName);
  811.             checkBoxGrp -e -v1 `eval $cmd` useSetColorChkBox;
  812.         }
  813.         $cmd = ($jasperCommand + " -q -colorrangelower " + $toolName);
  814.         floatSliderGrp -e -v `eval $cmd` crLower;
  815.         $cmd = ($jasperCommand + " -q -colorrangeupper " + $toolName);
  816.         floatSliderGrp -e -v `eval $cmd` crUpper;
  817.     }
  818.  
  819.     if ( $currentTool == "setEditPaint" ) {
  820.         $cmd = ($jasperCommand + " -q -setcolorfeedback " + $toolName);
  821.         checkBoxGrp -e -v1 `eval $cmd` setEditColorFeedbackChkBox;
  822.  
  823.         $cmd = ($jasperCommand + " -q -setdisplaycvs " + $toolName);
  824.         checkBoxGrp -e -v1 `eval $cmd` setEditDisplayCVsChkBox;
  825.     }
  826. }
  827.  
  828.  
  829. global proc updateBrushFeedback(
  830.     string $jasperCommand
  831. )
  832. {
  833.     $cmd = ($jasperCommand + " -q -outline `currentCtx`");
  834.     if ( `eval $cmd` ) {
  835.         $cmd = ($jasperCommand + " -q -brushfeedback `currentCtx`");
  836.         checkBoxGrp -e -v1 `eval $cmd` -en true brushFeedbackChkBox;
  837.  
  838.         $cmd = ($jasperCommand + " -q -outlinepaint `currentCtx`");
  839.         checkBoxGrp -e -v1 `eval $cmd` -en true drawOutlinePaintingChkBox;
  840.     }
  841.     else {
  842.         $cmd = ($jasperCommand + " -q -brushfeedback `currentCtx`");
  843.         checkBoxGrp -e -v1 `eval $cmd` -en false brushFeedbackChkBox;
  844.  
  845.         $cmd = ($jasperCommand + " -q -outlinepaint `currentCtx`");
  846.         checkBoxGrp -e -v1 `eval $cmd` -en false drawOutlinePaintingChkBox;
  847.     }
  848. }
  849.  
  850.  
  851. proc jasperMiscValues(
  852.     string $jasperCommand,
  853.     string $toolName,
  854.     int $force
  855. )
  856. {
  857.     string $cmd;
  858.     global int $jasperMiscActive;
  859.  
  860.     //  print ("jasperMiscValues( " + $force + ") active = " 
  861.     //          + $jasperMiscActive + "\n");
  862.  
  863.     if ( !$force && $jasperMiscActive ) { return; }
  864.     $jasperMiscActive = 1;
  865.  
  866.     //
  867.     //     Multiple Surface Detection frameLayout
  868.     //
  869.     $cmd = ($jasperCommand + " -q -multisurface " + $toolName);
  870.     string $value = `eval $cmd`;
  871.     if ( $value == "infinite" ) {
  872.         radioButtonGrp -e -sl 1 multiSurfaceRadio;
  873.     }
  874.     else if ( $value == "finite" ) { 
  875.         radioButtonGrp -e -sl 2 multiSurfaceRadio;
  876.     }
  877.  
  878.     $cmd = ($jasperCommand + " -q -multisurfacesize " + $toolName);
  879.     intSliderGrp -e -v `eval $cmd` multiSurfaceSizeSlider;
  880.  
  881.             
  882.     $cmd = ($jasperCommand + " -q -multisurfacemode " + $toolName);
  883.     checkBoxGrp -e -v1 `eval $cmd` multiSurfaceModeChkBox;
  884.  
  885.     // display the slider only if -multisurface = "finite"
  886.     updateMultiSurfaceSizeSlider( $jasperCommand );
  887.     updateMultiSurfaceModeChkBox( $jasperCommand );
  888.  
  889.  
  890.     //    
  891.     // Stamp Compensation frameLayout
  892.     //
  893.     $cmd = ($jasperCommand + " -q -compensate " + $toolName);
  894.     string $compensate = `eval $cmd`;
  895.     if ( $compensate == "none" ) {
  896.         radioButtonGrp -e -sl 1 comp0Radio;
  897.         text -e -l "% of surf" radiusUnits;
  898.         text -e -l "% of surf" lowerRadiusUnits;
  899.     } else {
  900.         text -e -l `currentUnit -q -l` radiusUnits;
  901.         text -e -l `currentUnit -q -l` lowerRadiusUnits;
  902.         if ( $compensate == "linear" ) {
  903.             radioButtonGrp -e -sl 1 comp1Radio;
  904.         } else if ( $compensate == "grid" ) {
  905.             radioButtonGrp -e -sl 1 comp2Radio;
  906.         }
  907.     }
  908.  
  909.     $cmd = ($jasperCommand + " -q -compgridradius " + $toolName);
  910.     intSliderGrp -e -v `eval $cmd` compGridRadius;
  911.  
  912.     //
  913.     // Paint Type frameLayout
  914.     //
  915.     $cmd = ($jasperCommand + " -q -painttype " + $toolName);
  916.     string $painttype = `eval $cmd`;
  917.     
  918.     if ( $painttype == "projective" ) {
  919.         radioButtonGrp -e -sl 1 paintType0Radio;
  920.     } else {
  921.         radioButtonGrp -e -sl 1 paintType1Radio;
  922.     }
  923.     updateReflectionChBox( $jasperCommand );    
  924.     updateStampCompensation(  $jasperCommand );
  925.  
  926.     //
  927.     // Stroke Smoothing frameLayout
  928.     //
  929.     $cmd = ($jasperCommand + " -q -tsmoothing " + $toolName);
  930.     checkBoxGrp -e -v1 `eval $cmd` texSmoothChkBox;
  931.  
  932.     $cmd = ($jasperCommand + " -q -ssmoothing " + $toolName);
  933.     checkBoxGrp -e -v1 `eval $cmd` screenSmoothChkBox;
  934.  
  935.     $cmd = ($jasperCommand + " -q -ssmoothingiters " + $toolName);
  936.     intSliderGrp -e -v `eval $cmd` divisionSlider;
  937.  
  938.     //
  939.     // Pre and Post stroke command frameLayout
  940.     //
  941.     $cmd = $jasperCommand + " -q -bsc " + $toolName;
  942.     textFieldGrp -e -text `eval $cmd` preStrokeTextField; 
  943.     $cmd = $jasperCommand + " -q -asc " + $toolName;
  944.     textFieldGrp -e -text `eval $cmd` postStrokeTextField;
  945. }
  946.  
  947.  
  948. // ===============================================
  949. // Procedures to set up environmnet correctly
  950. // ===============================================
  951. global proc updateFinite(
  952.     string $jasperCommand
  953. )
  954. {
  955.     $cmd = ($jasperCommand + " -q -multisurfacesize `currentCtx`" );
  956.     intSliderGrp -e -v `eval $cmd` -en true multiSurfaceSizeSlider;
  957. }
  958.  
  959.  
  960. global proc updateInFinite(
  961.     string $jasperCommand
  962. )
  963. {
  964.     $cmd = ($jasperCommand + " -q -multisurfacesize `currentCtx`") ;
  965.     intSliderGrp -e -v `eval $cmd` -en false multiSurfaceSizeSlider;
  966. }
  967.  
  968.  
  969. global proc updateMultiSurfaceSizeSlider(
  970.     string $jasperCommand
  971. )
  972. {
  973.     $cmd = ($jasperCommand + " -q -multisurface `currentCtx`");
  974.     string $multiSurf = `eval $cmd`;
  975.  
  976.     if ( $multiSurf == "infinite" ) {
  977.         $cmd = ($jasperCommand + " -q -multisurfacesize `currentCtx`");
  978.         intSliderGrp -e -v `eval $cmd` -en false multiSurfaceSizeSlider;
  979.     }
  980.     else {
  981.         $cmd = ($jasperCommand + " -q -multisurfacesize `currentCtx`");
  982.         intSliderGrp -e -v `eval $cmd` -en true multiSurfaceSizeSlider;
  983.     }
  984. }
  985.  
  986. global proc updateReflectionChBox(
  987.     string $jasperCommand
  988. )
  989. // 
  990. //     When projective paint is ON, grey out the reflection,
  991. //     and make sure that reflection is OFF    
  992. //
  993. {
  994.  
  995.     string  $cmd = ($jasperCommand + " -q -painttype `currentCtx`");
  996.     string  $painttype = eval( $cmd );
  997.     if ( $painttype == "projective" ) {
  998.         // grey out the reflection layout
  999.         // 
  1000.         if ( `frameLayout -exists reflectionFrameL` ) {
  1001.             frameLayout -e -enable false reflectionFrameL;
  1002.         }
  1003.  
  1004.         // if reflection is on, turn it off
  1005.         // 
  1006.         $cmd = ($jasperCommand + " -q -reflectpaint `currentCtx`");
  1007.         if ( eval($cmd) ) {
  1008.             eval( $jasperCommand + " -e -reflectpaint false `currentCtx`");
  1009.         }
  1010.     } else {
  1011.         if ( `frameLayout -exists reflectionFrameL` ) {
  1012.             frameLayout -e -enable true reflectionFrameL;
  1013.         }
  1014.     }
  1015. }
  1016.  
  1017. global proc updateStampCompensation( 
  1018.     string $jasperCommand
  1019. )
  1020. // 
  1021. //     When projective paint is ON, grey out the grid compensation 
  1022. //    and if grid compensation is ON, change it into a linear one    
  1023. //
  1024. {
  1025.     $cmd = ($jasperCommand + " -q -painttype `currentCtx`");
  1026.     string  $painttype = eval( $cmd );
  1027.     if ( $painttype == "projective" ) {
  1028.         // grey out the grid compensation
  1029.         // 
  1030.         string $comp = eval( $jasperCommand + " -q -compensate `currentCtx`" );
  1031.         if ( $comp == "grid" ) {
  1032.             // and switch to a linear compensation if necessary
  1033.             eval( $jasperCommand + " -e -compensate \"linear\" `currentCtx`");
  1034.         }
  1035.         radioButtonGrp -e -enable false comp2Radio;
  1036.         intSliderGrp -e -enable false  compGridRadius;
  1037.     } else {
  1038.         radioButtonGrp -e -enable true comp2Radio;
  1039.         intSliderGrp -e -enable true compGridRadius;
  1040.     }    
  1041. }
  1042.  
  1043. global proc updateMultiSurfaceModeChkBox( 
  1044.     string $jasperCommand
  1045. )
  1046. // 
  1047. //     When polys are present, turn OFF the layer mode and grey out the checkbox 
  1048. //
  1049. {
  1050.     // display the next checkbox only when there is no polys 
  1051.     // 
  1052.     string $cmd  = ($jasperCommand + " -q -pcs `currentCtx`");
  1053.     string $spec = eval( $cmd );
  1054.     
  1055.     if ( $spec == "nurbs" ) {
  1056.         if ( `checkBoxGrp -q -exists multiSurfaceModeChkBox` ) {
  1057.             checkBoxGrp -e -enable true  multiSurfaceModeChkBox;
  1058.         }
  1059.     } else {
  1060.         eval($jasperCommand + " -e -multisurfacemode false `currentCtx`");
  1061.         if ( `checkBoxGrp -q -exists multiSurfaceModeChkBox` ) {
  1062.             checkBoxGrp -e -v1 false -enable false multiSurfaceModeChkBox;
  1063.         }
  1064.     }
  1065. }
  1066.  
  1067. global proc updateSeamProperties(
  1068.     string $jasperCommand
  1069. )
  1070. // 
  1071. //     When polys are present, grey out the whole seam tab
  1072. //
  1073. {
  1074.     // display the following checkbox only when nurbs only
  1075.     // 
  1076.     string $cmd  = ($jasperCommand + " -q -pcs `currentCtx`");
  1077.     string $spec = eval( $cmd );
  1078.     
  1079.     if ( $spec == "nurbs" ) {
  1080.         if ( `frameLayout -exists brushModeLayout` ) {
  1081.             frameLayout -e -enable true brushModeLayout;
  1082.         }
  1083.         if ( `frameLayout -exists seamAutoLayout` ) {
  1084.             frameLayout -e -enable true seamAutoLayout;
  1085.         }
  1086.         if ( `frameLayout -exists commEdgeCornerLayout` ) {
  1087.             frameLayout -e -enable true commEdgeCornerLayout;
  1088.         }
  1089.         if ( `frameLayout -exists CommEdge` ) {
  1090.             frameLayout -e -enable true CommEdge;
  1091.         }
  1092.         if ( `frameLayout -exists CommCorner` ) {
  1093.             frameLayout -e -enable true CommCorner;
  1094.         }
  1095.         if ( `frameLayout -exists puttyStitchLayout` ) {
  1096.             frameLayout -e -enable true puttyStitchLayout;
  1097.         }
  1098.         if ( `frameLayout -exists valueStitchLayout` ) {
  1099.             frameLayout -e -enable true valueStitchLayout;
  1100.         }
  1101.         
  1102.         updateCommEdgeDisplayScreen( $jasperCommand );
  1103.     } else {
  1104.         if ( `frameLayout -exists brushModeLayout` ) {
  1105.             frameLayout -e -enable false brushModeLayout;
  1106.         }
  1107.         if ( `frameLayout -exists seamAutoLayout` ) {
  1108.             frameLayout -e -enable false seamAutoLayout;
  1109.         }
  1110.         if ( `frameLayout -exists commEdgeCornerLayout` ) {
  1111.             frameLayout -e -enable false commEdgeCornerLayout;
  1112.         }
  1113.         if ( `frameLayout -exists CommCorner` ) {
  1114.             frameLayout -e -enable false CommCorner;
  1115.         }
  1116.         if ( `frameLayout -exists CommEdge` ) {
  1117.             frameLayout -e -enable false  CommEdge;
  1118.         }
  1119.         if ( `frameLayout -exists puttyStitchLayout` ) {
  1120.             frameLayout -e -enable false puttyStitchLayout;
  1121.         }
  1122.         if ( `frameLayout -exists valueStitchLayout` ) {
  1123.             frameLayout -e -enable false valueStitchLayout;
  1124.         }
  1125.     }
  1126. }
  1127.  
  1128. global proc updateUVSculptDirection(
  1129.     string $jasperCommand
  1130. )
  1131. // 
  1132. //     When polys are present, grey out the uv directions in sculpt tool 
  1133. //
  1134. {
  1135.     // display the next checkbox only when nurbs only
  1136.     // 
  1137.     string $cmd  = ($jasperCommand + " -q -pcs `currentCtx`");
  1138.     string $spec = eval( $cmd );
  1139.     
  1140.     if ( $spec == "nurbs" ) {
  1141.         radioButtonGrp -e -enable true rv2Radio;
  1142.     }
  1143.     else {
  1144.         string $cmd1 = ($jasperCommand + " -q -refvector `currentCtx`");
  1145.         string $refvec = eval( $cmd1 );
  1146.         if ( ( $refvec == "visoparm" ) || ( $refvec == "uisoparm" ) ) {
  1147.             radioButtonGrp -e -sl 1 rv0Radio;
  1148.             eval( $jasperCommand + " -e -refvector \"normal\" `currentCtx`" );
  1149.         }
  1150.         radioButtonGrp -e -enable false rv2Radio;
  1151.     }
  1152. }
  1153. // ==================================================
  1154. // End of procedures to set up environmnet correctly
  1155. // ==================================================
  1156.  
  1157.  
  1158. // these globals are used to keep track of script jobs
  1159. //
  1160. global int $jasperScriptJob = -1;
  1161. global int $jasperToolChangedJob = -1;
  1162. global int $jasperReaperJob = -1;
  1163.  
  1164.  
  1165. // these flags indicate whether the specified tab has been shown
  1166. // while the current context has been active
  1167. //
  1168. global int $jasperSculptActive  = 0;
  1169. global int $jasperWeightActive  = 0;
  1170. global int $jasperSelectActive  = 0;
  1171. global int $jasperSetEditActive = 0;
  1172. global int $jasperStampActive   = 0;
  1173. global int $jasperStrokeActive  = 0;
  1174. global int $jasperSeamActive    = 0;
  1175. global int $jasperMaskActive    = 0;
  1176. global int $jasperMapActive     = 0;
  1177. global int $jasperDisplayActive = 0;
  1178. global int $jasperMiscActive = 0;
  1179. global int $jasperSetupActive = 0;
  1180. global int $jasperAttrActive = 0;
  1181.  
  1182.  
  1183. // string that indicates which tool context we think we're in
  1184. //
  1185. global string $jasperCurContext;
  1186.  
  1187. // jasperUnitsChanged is called when current linear units have
  1188. // changed
  1189. // - it assumes that Maya is currently in a Jasper tool
  1190. //
  1191. global proc jasperUnitsChanged(
  1192.     string $parent,
  1193.     string $jasperCommand
  1194. )
  1195. {
  1196.     global int $jasperStampActive;
  1197.     global int $jasperSculptActive;
  1198.     global int $jasperShellActive;
  1199.  
  1200.     string $cmd;
  1201.     string $cc = `currentCtx`;
  1202.     string $cu = `currentUnit -q -l`;
  1203.  
  1204.     setParent $parent;
  1205.  
  1206.     if ( $jasperStampActive ) {
  1207.         // Only change radius units if we are in a compensated mode.
  1208.         //
  1209.         $cmd = ($jasperCommand + " -q -compensate " + $cc);
  1210.         string $compensate = `eval $cmd`;
  1211.         if ( $compensate != "none" ) {
  1212.             // update radius units and radius slider
  1213.             //
  1214.             text -e -l $cu radiusUnits;
  1215.             text -e -l $cu lowerRadiusUnits;
  1216.             $cmd = ($jasperCommand + " -q -radius " + $cc);
  1217.             floatSliderGrp -e -v `eval $cmd` radius;
  1218.             $cmd = ($jasperCommand + " -q -lowerradius " + $cc);
  1219.             floatSliderGrp -e -v `eval $cmd` lowerRadius;
  1220.         }
  1221.     }
  1222.  
  1223.     // if this dialog contains sculpt tab, update the max
  1224.     // displacement slider and it's unit label
  1225.     //
  1226.     if ( $jasperSculptActive ) {
  1227.         text -e -l $cu maxDispUnits;
  1228.         $cmd = ($jasperCommand + " -q -maxdisp " + $cc);
  1229.         floatSliderGrp -e -v `eval $cmd` maxDisp;
  1230.     }
  1231.  
  1232.     // if this dialog contains shell tab, update the tolerance
  1233.     // slider and it's unit label
  1234.     //
  1235.     if ( $jasperShellActive ) {
  1236.         text -e -l $cu commEdgesTolUnits;
  1237.         $cmd = ($jasperCommand + " -q -commedgetol " + $cc);
  1238.         floatSliderGrp -e -v `eval $cmd` commEdgesTol;
  1239.  
  1240.         text -e -l $cu collapseCVTolUnits;
  1241.         $cmd = ($jasperCommand + " -q -collapsecvtol " + $cc);
  1242.         floatSliderGrp -e -v `eval $cmd` collapseCVTol;
  1243.     }
  1244.  
  1245.     // tell the context to update the status line
  1246.     //
  1247.     eval ($jasperCommand + " -e -usl " + $cc);
  1248. }
  1249.  
  1250. proc resetJasperActiveFlags()
  1251. {
  1252.     global int $jasperSculptActive;
  1253.     global int $jasperWeightActive;
  1254.     global int $jasperSelectActive;
  1255.     global int $jasperSetEditActive;
  1256.     global int $jasperStampActive;
  1257.     global int $jasperStrokeActive;
  1258.     global int $jasperSeamActive;
  1259.     global int $jasperMaskActive;
  1260.     global int $jasperMapActive;
  1261.     global int $jasperDisplayActive;
  1262.     global int $jasperMiscActive;
  1263.     global int $jasperSetupActive;
  1264.     global int $jasperAttrActive;
  1265.  
  1266.     $jasperSculptActive  = 0;
  1267.     $jasperWeightActive  = 0;
  1268.     $jasperSelectActive  = 0;
  1269.     $jasperSetEditActive = 0;
  1270.     $jasperStampActive   = 0;
  1271.     $jasperStrokeActive  = 0;
  1272.     $jasperSeamActive    = 0;
  1273.     $jasperMaskActive    = 0;
  1274.     $jasperMapActive     = 0;
  1275.     $jasperDisplayActive = 0;
  1276.     $jasperMiscActive = 0;
  1277.     $jasperSetupActive = 0;
  1278.     $jasperAttrActive = 0;
  1279. }
  1280.  
  1281. // This is called to reset all the stuff related to active
  1282. // flags for all the various tabs that are contained in Jasper
  1283. // UI dialogs. It also kills the script job that was setup to
  1284. // update the UI when the current units change.
  1285. //
  1286. proc resetJasperTool(
  1287.     int $deleteSetWindow
  1288. )
  1289. {
  1290.     //  print ("in resetJasperTool()\n");
  1291.  
  1292.     global int $jasperScriptJob;
  1293.     global string $jasperCurContext;
  1294.     
  1295.     if ( $jasperScriptJob != -1 ) {
  1296.         scriptJob -force -kill $jasperScriptJob;
  1297.         $jasperScriptJob = -1;
  1298.     }
  1299.  
  1300.     resetJasperActiveFlags();
  1301.     $jasperCurContext = "";
  1302. }
  1303.  
  1304.  
  1305. global proc jasperToolChanged(
  1306.     int $fromToolChangedScriptJob
  1307. )
  1308. {
  1309.     global int         $jasperToolChangedJob;
  1310.     global int         $jasperReaperJob;
  1311.     global string     $jasperCurContext;
  1312.  
  1313.     resetJasperTool( $fromToolChangedScriptJob );
  1314.  
  1315.     // if we weren't called from the tool changed script job
  1316.     // we have to kill it ourselves
  1317.     //
  1318.     if ( ! $fromToolChangedScriptJob && $jasperToolChangedJob != -1 ) {
  1319.         scriptJob -force -kill $jasperToolChangedJob;
  1320.     }
  1321.     $jasperToolChangedJob = -1;
  1322.  
  1323.     // we also kill the reaper script job if it's there
  1324.     //
  1325.     if ( $jasperReaperJob != -1 ) {
  1326.         scriptJob -force -kill $jasperReaperJob;
  1327.         $jasperReaperJob = -1;
  1328.     }
  1329. }
  1330.  
  1331.  
  1332. global proc jasperUIDeleted()
  1333. {
  1334.     //  print ("in jasperUIDeleted()\n");
  1335.  
  1336.     global int $jasperToolChangedJob;
  1337.     global int $jasperReaperJob;
  1338.  
  1339.     resetJasperTool( 0 );
  1340.  
  1341.     // if the tool changed script job is running, we have to kill it
  1342.     //
  1343.     if ( $jasperToolChangedJob != -1 ) {
  1344.         scriptJob -force -kill $jasperToolChangedJob;
  1345.         $jasperToolChangedJob = -1;
  1346.     }
  1347.  
  1348.     // since this was called from the script job, we assume the
  1349.     // script job will be killed after this.
  1350.     //
  1351.     $jasperReaperJob = -1;
  1352. }
  1353.  
  1354.  
  1355. proc doJasperValues(
  1356.     string $jasperCmd, 
  1357.     string $toolName,
  1358.     string $currentTab,
  1359.     int $force
  1360. )
  1361. {
  1362.     //  print ("in doJasperValues: parent = " + `setParent -q` + "\n");
  1363.  
  1364.     // create a couple of script jobs that will handle changes in
  1365.     // the current radius units 
  1366.     //
  1367.     global int $jasperScriptJob;
  1368.     global int $jasperToolChangedJob;
  1369.     global int $jasperReaperJob;
  1370.     global string $jasperCurContext;
  1371.     int $startScriptJobs;
  1372.  
  1373.     if ( $jasperScriptJob == -1 ) {
  1374.         $startScriptJobs = 1;
  1375.     } else {
  1376.         // A script job is running. Check if the current context
  1377.         // and the one we think we're in don't match, if so we must
  1378.         // have switched from one Jasper tool to another. Call
  1379.         // resetJasperTool() to reset everything
  1380.         //
  1381.         if ( $toolName != $jasperCurContext ) {
  1382.             jasperToolChanged( 0 );
  1383.             $startScriptJobs = 1;
  1384.         } else {
  1385.             $startScriptJobs = 0;
  1386.         }
  1387.     }
  1388.  
  1389.     if ( $startScriptJobs ) {
  1390.         string $parent = `setParent -q`;
  1391.  
  1392.         $jasperScriptJob = `scriptJob -protected -event "linearUnitChanged"
  1393.             ("jasperUnitsChanged " + $parent + " " + $jasperCmd + ";")`;
  1394.         
  1395.         // Create another script job which will kill the previous
  1396.         // one when a tool change happens. This is only run once, 
  1397.         // so it will be destroyed when it is triggered
  1398.         //
  1399.         if ( $jasperToolChangedJob == -1 ) {
  1400.             $jasperToolChangedJob = `scriptJob -runOnce true
  1401.                 -event "ToolChanged" "jasperToolChanged( 1 )"`;
  1402.         }
  1403.         $jasperCurContext = $toolName; 
  1404.  
  1405.         // create another script that gets called if the parent
  1406.         // gets destroyed. It will get rid of the other two jobs.
  1407.         // This one will only get run once.
  1408.         //
  1409.         if ( $jasperReaperJob == -1 ) {
  1410.             $jasperReaperJob = 
  1411.                 `scriptJob -protected -uiDeleted $parent "jasperUIDeleted()"`;
  1412.         }
  1413.     }
  1414.  
  1415.     string $currentContext  = `currentCtx`;
  1416.     string $currentTool     = `contextInfo -c $currentContext`;
  1417.  
  1418.     if( $currentTab == "Sculpt" ) { 
  1419.         jasperSculptValues( $jasperCmd, $toolName, $currentTool, $force );
  1420.     }
  1421.     else if( $currentTab == "Script_Paint" )
  1422.     { 
  1423.         jasperValueValues( $jasperCmd, $toolName, $currentTool, $force, false, "" );
  1424.     }
  1425. // OBSOLETE
  1426. /*
  1427.     if ( $currentTab == "Paint" ) {
  1428.         paintColorTabValues( $jasperCmd, $toolName, $currentTool, $force );
  1429.     } 
  1430.     else if( $currentTab == "File_Textures" ) {
  1431.         paintColorFileValues( $jasperCmd, $toolName, $currentTool, $force );
  1432.     }
  1433.     else if( $currentTab == "Select" ) {
  1434.         jasperSelectValues( $jasperCmd, $toolName, $currentTool, $force );
  1435.     }
  1436. */
  1437.     else if( $currentTab == "SetMembership" ) {
  1438.         jasperSetEditValues( $jasperCmd, $toolName, $currentTool, $force );
  1439.     }
  1440.     else if( $currentTab == "Stroke" ) { 
  1441.         jasperStrokeValues( $jasperCmd, $toolName, $currentTool, $force );
  1442.     }       
  1443.     else if( $currentTab == "Seam" ) { 
  1444.         jasperSeamValues( $jasperCmd, $toolName, $currentTool, $force );
  1445.     }       
  1446.     else if( $currentTab == "Mask" ) { 
  1447.         jasperMaskValues( $jasperCmd, $toolName, $force );
  1448.     }
  1449.     else if( $currentTab == "Map" ) {
  1450.         jasperMapValues( $jasperCmd, $toolName, $currentTool, $force );
  1451.     }
  1452.     else if( $currentTab == "Display" ) { 
  1453.         if ( $currentTool == "paintColor" ) {
  1454.             paintColorDisplayValues( $jasperCmd, $toolName, $force );
  1455.         } else {
  1456.             jasperDisplayValues( $jasperCmd, $toolName, $currentTool, $force );
  1457.         }
  1458.     } 
  1459.     else if( $currentTab == "Misc" ) {
  1460.         if ( $currentTool == "paintColor" ) {
  1461.             paintColorMiscValues( $jasperCmd, $toolName, $force );
  1462.         } else {
  1463.             jasperMiscValues( $jasperCmd, $toolName, $force );
  1464.         }
  1465.     }
  1466.     else if( $currentTab == "Setup" ) { 
  1467.         jasperSetupValues( $jasperCmd, $toolName, $force );
  1468.     }
  1469. /*
  1470.     else if( $currentTab == "Attr" ) { 
  1471.         jasperAttrValues( $jasperCmd, $toolName, $currentTool, $force );
  1472.     }
  1473. */
  1474.     else {
  1475.         attrPaintInstValueDefine( 
  1476.             $jasperCmd, $toolName, $currentTool, $force, $currentTab 
  1477.         );
  1478.     }
  1479.     if( $jasperCmd == "attrPaintCtx" ) {
  1480.         attrPaintInstCustomizeUI( 
  1481.             $jasperCmd, $toolName, $currentTool, $force, $currentTab 
  1482.         );
  1483.     }
  1484. }
  1485.  
  1486.  
  1487. global proc jasperValues(
  1488.     string $jasperCommand, 
  1489.     string $toolName,
  1490.     string $currentTab
  1491. )
  1492. {
  1493.     source "jasperCallback.mel";
  1494.  
  1495.     // print "in jasperValues\n";
  1496.     resetJasperActiveFlags();
  1497.     doJasperValues( $jasperCommand, $toolName, $currentTab, 1 );
  1498. }
  1499.  
  1500.  
  1501. global proc updateJasperValues(
  1502.     string $jasperCommand, 
  1503.     string $toolName,
  1504.     string $currentTab
  1505. )
  1506. {
  1507.     //  print "in updateJasperValues\n";
  1508.     doJasperValues( $jasperCommand, $toolName, $currentTab, 0 );
  1509. }
  1510.  
  1511.  
  1512.